<?php
namespace app\index\model;

use think\Model;
use think\Db;

class Userinfomodel extends Model
{


    public function let($uid)
    {
        return $result = Db::table("rs_puser")->where("id", $uid)->find();
    }

    public function register($data, $data2, $data3)
    {
        Db::startTrans();
        try {
            Db::table('rs_puser_info')->insert($data);
            Db::table('rs_education')->insert($data2);
            Db::table('rs_resume')->insert($data3);
            // 提交事务
            Db::commit();
            return true;
        } catch (\Exception $e) {
            // 回滚事务
            Db::rollback();

            return false;
        }


    } 


    public function sel($id){
        return $result = Db::table('rs_puser_info')->where($id)->alias("i")->join("rs_pc_areas a","i.city=a.areaid","LEFT")->join("rs_resume r","i.uid=r.uid","LEFT")->join("rs_education e","r.uid=e.uid","LEFT")
            ->join("rs_wrokday w","e.wrokeday=w.id","LEFT")
            ->join("rs_study s","s.id=e.studyName","LEFT")->find();

    }
    public function xg1($id,$data){
        return Db::table("rs_resume")->where('uid',$id)->update($data);
    }
    public function jy1($id,$data){
        return Db::table("rs_education")->where('uid',$id)->update($data);
    }
}